package com.hamizhong.iflowers.web.action.admin.prodgoods;

import java.util.List;

import com.hamizhong.iflowers.service.IColorService;
import com.hamizhong.iflowers.service.IProductService;
import com.hamizhong.iflowers.service.IVarietyService;
import com.hamizhong.iflowers.utils.MyConstants;
import com.hamizhong.iflowers.web.base.MyBaseAction;
import com.hamizhong.iflowers.web.dto.IOPResultDto;
import com.hamizhong.iflowers.web.vo.ColorVO;
import com.hamizhong.iflowers.web.vo.IObjectVO;
import com.hamizhong.iflowers.web.vo.VarietyVO;

public class ProductManageAction extends MyBaseAction {
	
	private IProductService iProductService = null;
	private IVarietyService iVarietyService = null;
	private IColorService iColorService = null;
	
	public IProductService getiProductService() {
		return iProductService;
	}
	public void setiProductService(IProductService iProductService) {
		this.iProductService = iProductService;
	}
	public IVarietyService getiVarietyService() {
		return iVarietyService;
	}
	public void setiVarietyService(IVarietyService iVarietyService) {
		this.iVarietyService = iVarietyService;
	}
	public IColorService getiColorService() {
		return iColorService;
	}
	public void setiColorService(IColorService iColorService) {
		this.iColorService = iColorService;
	}

	@Override
	protected String doRequest() {
		logger.info("----------------- Hello ProductManageAction -----------------");
		//IOPResultDto<IObjectVO> iopResultDto = iProductService.findAll(1, MyConstants.SIZE_OF_COMMON_FINDALL);
		IOPResultDto<IObjectVO> iopVarietyDto = iVarietyService.findAll(1, MyConstants.SIZE_OF_COMMON_FINDALL);
		IOPResultDto<IObjectVO> iopColorDto = iColorService.findAll(1, MyConstants.SIZE_OF_COMMON_FINDALL);
		List<VarietyVO> varietyVOList = iopVarietyDto.getFirstResult().getVarietyVOList();
		List<ColorVO> colorVOList = iopColorDto.getFirstResult().getColorVOList();
		getRQ().setAttribute("varietyVOList", varietyVOList);
		getRQ().setAttribute("colorVOList", colorVOList);
		return SUCCESS;
	}

}
